Skip to content

✨ Display per-currency book price overrides at point of purchase#1150

Merged
williamchong merged 1 commit into
likecoin:developfrom
williamchong:feature/store
May 20, 2026
Merged

✨ Display per-currency book price overrides at point of purchase#1150
williamchong merged 1 commit into
likecoin:developfrom
williamchong:feature/store

Conversation

@williamchong
Copy link
Copy Markdown
Member

@williamchong williamchong commented May 19, 2026

Honour the API's optional priceInDecimalByCurrency so the HKD/TWD price shown on the store, product and checkout pages matches what Stripe will actually charge, instead of the index-based ladder conversion.

Resolution is centralised in useCurrency (override beats ladder, USD unchanged); checkout resolves each line once so rows and the grand total cannot diverge, and the min-tier lookup now has a single source in useBookInfo.

Requires: likecoin/likecoin-api-public#1265

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the store/product/checkout pricing display logic to honor the API’s optional priceInDecimalByCurrency per-currency overrides, aiming to show customers the same HKD/TWD price that Stripe will charge (instead of relying solely on the USD index ladder conversion).

Changes:

  • Add priceInDecimalByCurrency typing to BookstorePrice and propagate it through useBookInfo pricing items.
  • Centralize override-vs-ladder resolution in useCurrency, and introduce formatConvertedPrice for formatting amounts already resolved into the display currency.
  • Update store/product list and checkout UIs to pass/consume currency overrides and compute converted line totals once to prevent row/total divergence.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
shared/types/bookstore.d.ts Adds the per-currency override type and attaches it to BookstorePrice.
app/composables/use-currency.ts Centralizes override resolution and adds formatting for already-converted totals.
app/composables/use-book-info.ts Propagates override data and exposes minPricingItem for consistent min-tier access.
app/pages/store/[nftClassId]/index.vue Uses override-aware formatting for edition prices on the product page.
app/components/BookstoreItem.vue Uses min-tier override when available for catalog tile pricing/discount display.
app/components/BookListItem.vue Uses tier override for list item pricing/discount display.
app/pages/checkout.vue Computes per-line converted totals once and formats totals without double conversion.

Comment on lines +41 to +48
const currency = displayCurrency.value
if (currency !== 'usd') {
const override = priceInDecimalByCurrency?.[currency]
if (typeof override === 'number' && override > 0) {
return override / 100
}
}
return convertUSDPriceToCurrency(usdPrice, currency)
Honour the API's optional priceInDecimalByCurrency so the HKD/TWD price
shown on the store, product and checkout pages matches what Stripe will
actually charge, instead of the index-based ladder conversion.

Resolution is centralised in useCurrency (override beats ladder, USD
unchanged); checkout resolves each line once so rows and the grand
total cannot diverge, and the min-tier lookup now has a single source
in useBookInfo.
@williamchong williamchong marked this pull request as ready for review May 20, 2026 09:54
@williamchong williamchong merged commit 7c19ff0 into likecoin:develop May 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants